package com.example.chapter04;

import androidx.appcompat.app.AppCompatActivity;

import android.content.pm.ActivityInfo;
import android.content.pm.PackageManager;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.TextView;

public class MetaDataActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_meta_data);
        //
        //TextView tv_metaData = findViewById(R.id.tv_meta_data);
        //// 获取应用包管理器
        //PackageManager packageManager = getPackageManager();
        //try {
        //    // 从应用包管理器中获取当前的活动信息
        //    ActivityInfo activityInfo = packageManager.getActivityInfo(getComponentName(), PackageManager.GET_META_DATA);
        //
        //    // ComponentInfo{com.example.chapter04/com.example.chapter04.MetaDataActivity}
        //    Log.d("=============", getComponentName().toString());
        //    // 获取活动附加的元数据信息
        //    Bundle metaData = activityInfo.metaData;
        //    String weather = metaData.getString("weather");
        //    tv_metaData.setText(weather);
        //
        //} catch (PackageManager.NameNotFoundException e) {
        //    throw new RuntimeException(e);
        //}

    }
}